﻿@model IList<Nop.Admin.Models.Customers.CustomerModel.CustomerAttributeModel>
@using Nop.Core.Domain.Catalog;
@foreach (var attribute in Model)
{
    string controlId = string.Format("customer_attribute_{0}", attribute.Id);
    string textPrompt = attribute.Name;

    <tr>
        <td class="adminTitle">
            @textPrompt:
        </td>
        <td class="adminData">

            @switch (attribute.AttributeControlType)
            {
                case AttributeControlType.DropdownList:
                    {
                        <select name="@(controlId)" id="@(controlId)">
                            @if (!attribute.IsRequired)
                    {
                    <option value="0">---</option>
                    }
                            @foreach (var caValue in attribute.Values)
                    {
                    <option selected="@caValue.IsPreSelected" value="@caValue.Id">@caValue.Name</option>
                    }
                        </select>
                    }
                    break;
                case AttributeControlType.RadioList:
                    {
                        <ul class="option-list">
                            @foreach (var caValue in attribute.Values)
                    {
                    <li>
                        <input id="@(controlId)_@(caValue.Id)" type="radio" name="@(controlId)" value="@caValue.Id" checked="@caValue.IsPreSelected" />
                        <label for="@(controlId)_@(caValue.Id)">@caValue.Name</label>
                    </li>
                    }
                        </ul>
                    }
                    break;
                case AttributeControlType.Checkboxes:
                case AttributeControlType.ReadonlyCheckboxes:
                    {
                        <ul class="option-list">
                            @foreach (var caValue in attribute.Values)
                    {
                    <li>
                        <input id="@(controlId)_@(caValue.Id)" type="checkbox" name="@(controlId)" value="@caValue.Id" checked="@caValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? " disabled=\"disabled\"" : null) />
                        <label for="@(controlId)_@(caValue.Id)">@caValue.Name</label>
                    </li>
                    }
                        </ul>
                    }
                    break;
                case AttributeControlType.TextBox:
                    {
                        <input name="@(controlId)" type="text" class="text-box single-line" id="@(controlId)" @(!String.IsNullOrWhiteSpace(attribute.DefaultValue) ? " value=" + attribute.DefaultValue : null) />
                    }
                    break;
                case AttributeControlType.MultilineTextbox:
                    {
                        <textarea id="@(controlId)" style="Width: 250px; Height: 150px;" name="@(controlId)">@(!String.IsNullOrWhiteSpace(attribute.DefaultValue) ? attribute.DefaultValue : null)</textarea>
                    }
                    break;
                case AttributeControlType.Datepicker:
                case AttributeControlType.FileUpload:
                case AttributeControlType.ColorSquares:
                    {
                        //not support attribute type
                    }
                    break;
            }
        </td>
    </tr>
}
